home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-09 | 1.5 KB | 41 lines | [TEXT/ToyS] |
-
- set myList to {"Bennet", "Brett", "Bruce", "Dan", "Dave", "Gary", "Ike", "James", "Jens", "Jon", "Ken", "Lee", "Mark", "Ron", "Scott", "Steve", "Sue", "Tom", "Warren", "William"}
- set myDefault to "" -- no item selected initially
- set myPrompt to "Give a bonus to which employee:"
- openDialogServer()
- set luckyOne to chooseOne(myPrompt, myList, myDefault)
- if luckyOne is "" then
- display dialog "Sorry, no one was deemed worthy of a bonus." buttons "OK" default button 1
- else
- set myPrompt to "How generous do you want to be with " & luckyOne & "?"
- set myList to {"5¢", "$2.00", "$50.00", "$100.00", "$500.00", "$1000.00"}
- set myDefault to "$100.00"
- set bonusAmount to chooseOne(myPrompt, myList, myDefault)
- if bonusAmount is "" then
- display dialog "On second thought, there’s not enough cash to give out a bonus!" buttons "OK" default button 1
- else
- display dialog luckyOne & ", report to the boss for your " & bonusAmount & " bonus check!" buttons "OK" default button 1
- end if
- end if
- closeDialogServer()
-
- to openDialogServer()
- tell application "Dialog Server.mini"
- launch -- without sending a "run" message to the application
- end tell
- end openDialogServer
-
- to closeDialogServer()
- tell application "Dialog Server.mini"
- quit
- end tell
- end closeDialogServer
-
- to chooseOne(myPrompt, myList, myDefault)
- tell application "Dialog Server.mini"
- activate -- bring dialog server to the front
- set selectedItem to listDialog(myPrompt, myList, myDefault)
- end tell
- activate current application -- return to our application (script editor)
- return selectedItem
- end chooseOne